<%--
  Created by IntelliJ IDEA.
  User: 86183
  Date: 2019/9/12
  Time: 11:32
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%String path = request.getContextPath();%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<table class="result-tab" width="100%">
    <tr>
        <th>ID</th>
        <th>用户信息</th>
        <th>日志详情</th>
        <th>发布时间</th>
        <th>操作</th>
    </tr >

    <c:forEach items="${requestScope.pageInfo.list}" var="journal" varStatus="stat">
        <tr>
            <td class="id2">${journal.id}</td>
            <td class="name" data-id="${journal.userinfo.id}">${journal.userinfo.name}</td>
            <td class="title" data-id1="${journal.id}">${journal.title}</td>
            <td><fmt:formatDate value="${journal.inputTime}" pattern="yyyy-MM-dd  HH:mm:ss"/></td>
            <td><a class="fengting" data-id2="${journal.id}" style="color:red;">封停</a></td>
        </tr>

    </c:forEach>

</table>
<tr>
    <div class="biankuang">

        <td colspan="7">
            <c:forEach  items="${requestScope.pageInfo.navigatepageNums}" var="i">
                <c:if test="${requestScope.pageInfo.pageNum eq i}" var="result">
                    <a href="#" id="ids" class="num pageNum" id="${i}">${i}</a>
                </c:if>
                <c:if test="${not result}" >
                    <a href="#" id="ids" class="num" id="${i}">${i}</a>
                </c:if>
            </c:forEach>
        </td>
    </div>
</tr>
<script>
    var pageNum;

    $(".fengting").click(function () {
        if (window.confirm("你确定要封停吗?")) {
        var action ="${pageContext.request.contextPath}/manage/show/seal";
        var id = $(this).data("id2");
        var enable = 0;
        $.post(action,{id:id,enable:enable},function () {
            initData(pageNum);
        })
        }
    })


    $(".num").click(function () { //给页码加点击事件
        pageNum = $(this).html();

        initData(pageNum);

        return false;
    });

    function initData(pageNum)
    {
        var pageNum = {pageNum: pageNum};
        $.post("${pageContext.request.contextPath}/manage/ajaxJsp/findDaily", pageNum, function (mes) {
                $("#show").html(mes);
            }
        );

    }

    $(".result-tab .title").click(function () {
        var id = $(this).data("id1");
        layer.open({

            type: 2,
            title: '日志详情。',
            shadeClose: true,
            shade: false,
            maxmin: true, //开启最大化最小化按钮
            area: ['893px', '600px'],
            content: '<%=path%>/manage/ajaxJsp/logDetails?id='+id
        });

    })
    $(".result-tab .name").click(function () {
        var id = $(this).data("id");
        layer.open({

            type: 2,
            title: '用户信息。',
            shadeClose: true,
            shade: false,
            maxmin: true, //开启最大化最小化按钮
            area: ['893px', '600px'],
            content: '<%=path%>/manage/ajaxJsp/userdetails?id='+id
        });

    })
</script>

